<template>
  <div>
    <h1>我计算的是减法，我要算的数字是:{{$store.state.count}}</h1>
    <h6>{{$store.getters.setNum}}</h6>
    <div>
      <span>简单的加减</span>
      <button @click="subHandle">-</button>
    </div>
    <div>
      <span>成倍加减</span>
      <button @click="subMoreHandle">-</button>
    </div>
    <div>
      <span>异步加减</span>
      <button @click="subAsyncHandle">-</button>
    </div>
    <div>
      <span>异步成倍加减</span>
      <button @click="subAMoreHandle">-</button>
    </div>
  </div>
</template>

<script>
export default {
  name: 'jianfa',
  data() {
    return {}
  },
  computed: {},
  methods: {
    // 简单的减法
    subHandle() {
      this.$store.commit('SubFun')
    },
    // 成倍加减
    subMoreHandle() {
      this.$store.commit('subFunMore', 3)
    },

    // 异步减法
    subAsyncHandle() {
      this.$store.dispatch('subAsync')
    },
    // 异步成倍加减
    subAMoreHandle() {
      this.$store.dispatch('subAMore', 3)
    }
  }
}
</script>

<style lang="less" scoped>
</style>
